import request from '../utils/request';


// 获取医疗人员列表
export const getDoctorList = query => {
    return request({
        url: '/medicine/doctor/list/',
        method: 'get',
        params: query
    });
};

// 修改医疗人员信息
export const modifyDoctor = form => {
    return request({
        url: '/medicine/doctor',
        method: 'put',
        data: form
    });
};

// 新增医疗人员
export const addDoctor = form => {
    return request({
        url: '/medicine/doctor',
        method: 'post',
        data: form
    });
};

// 删除医疗人员
export const deleteDoctor = param => {
    return request({
        url: '/medicine/doctor/?id=' + param,
        method: 'delete'
    });
};

// 获取药品信息列表
export const getMedicineList = query => {
    return request({
        url: '/medicine/medicine/list/',
        method: 'get',
        params: query
    });
};

// 修改药品信息
export const modifyMedicine = form => {
    return request({
        url: '/medicine/medicine',
        method: 'put',
        data: form
    });
};

// 补货
//销售订单出库
// export const confirmReplenish = param => {
//     return request({
//         url: '/medicine/medicine/confirm/?medicineId='+param,
//         method: 'put',
//         data:param
//     });
// };

// 添加药品
export const addMedicine = form => {
    return request({
        url: '/medicine/medicine',
        method: 'post',
        data: form
    });
};

// 删除药品
export const deleteMedicine = param => {
    return request({
        url: '/medicine/medicine/?id='+param,
        method: 'delete'
    });
};


// 获取供应商信息列表
export const getSupplierList = query => {
    return request({
        url: '/medicine/supplier/list/',
        method: 'get',
        params: query
    });
};

// 修改供应商信息
export const modifySupplier = form => {
    return request({
        url: '/medicine/supplier',
        method: 'put',
        data: form
    });
};

// 添加供应商
export const addSupplier = form => {
    return request({
        url: '/medicine/supplier',
        method: 'post',
        data: form
    });
};

// 删除供应商
export const deleteSupplier = param => {
    return request({
        url: '/medicine/supplier/?id='+param,
        method: 'delete'
    });
};

// 获取采购信息列表
export const getBillList = query => {
    return request({
        url: '/medicine/bill/list/',
        method: 'get',
        params: query
    });
};

// 获取采购信息详情
export const getBillDetail = param => {
    return request({
        url: '/medicine/bill/'+param,
        method: 'get',
    });
};




// 采购登记
export const addBill = form => {
    return request({
        url: '/medicine/bill/particular',
        method: 'post',
        data: form
    });
};


// 获取所有医生信息列表
export const allDoctor = () => {
    return request({
        url: '/medicine/doctor/all'
    })
}

// // 获取当前医生信息列表
// export const nowDoctor = param => {
//     return request({
//         url: '/medicine/doctor/now/?id='=param,
//         method:'GET',
//         data:param
//     })
// }


// 获取所有供应商信息列表
export const allSupplier = () => {
    return request({
        url: '/medicine/supplier/all'
    })
}

// 获取所有供应商信息列表
export const allMedicine = () => {
    return request({
        url: '/medicine/medicine/all'
    })
};

// 销售登记
export const addPatientBill = form => {
    return request({
        url: '/medicine/patient-bill/particular',
        method: 'post',
        data: form
    });
};

// 获取销售信息列表
export const getPatientBillList = query => {
    return request({
        url: '/medicine/patient-bill/list/',
        method: 'get',
        params: query
    });
};

// 获取销售信息详情
export const getPatientBillDetail = param => {
    return request({
        url: '/medicine/patient-bill/message/'+param,
        method: 'get',
    });
};

//销售订单出库
export const outStock = param => {
    return request({
        url: '/medicine/patient-bill/out/?patientBillId='+param,
        method: 'put',
        data:param
    });
};

//取消销售订单
export const cancelStock = param => {
    return request({
        url: '/medicine/patient-bill/cancel/?patientBillId='+param,
        method: 'put',
        data:param
    });
};

// 新增账号
export const addAdmin = form => {
    return request({
        url: '/medicine/administrator',
        method: 'post',
        data: form
    });
};

// 修改密码
export const modifyAdmin = form => {
    return request({
        url: '/medicine/administrator',
        method: 'put',
        data: form
    });
};

// 获取账号列表
export const getAdminList = query => {
    console.log(query);
    return request({
        url: '/medicine/administrator/list/',
        method: 'get',
        params: query
    });
};

// 删除账号
export const deleteAdmin = param => {
    return request({
        url: '/medicine/administrator/?id=' + param,
        method: 'delete'
    });
};

// 登录
export const loginAdmin = form => {
    return request({
        url: '/medicine/administrator/login',
        method: 'post',
        params: form
    });
};

// 获取基本数据
export const getBaseData = () => {
    return request({
        url: '/medicine/data/base',
        method: 'get'
    });
};

// 获取柱状图数据
export const getBarData = () => {
    return request({
        url: '/medicine/data/bar',
        method: 'get'
    });
};

// 获取饼状图数据
export const getPieData = () => {
    return request({
        url: '/medicine/data/pie',
        method: 'get'
    });
};